\chapter{Using PORN-OS}

When the OS starts, init does so and initially starts a shell. You can use it to input commands and asks the kernel to do what it has been designed for.

The commands and features of the shell and the others user programs are covered in details in PORN-OS' \textit{user programs guide}.

In this document, we will quickly go through all the programs that can be found in the system.

\section{Init}

This program is the only mandatory program in PORN-OS. It is started by the operating system when it boots but is just a regular user program otherwise. You can edit it to do anything you want when the system starts. The initial version of this program starts the scroller and a shell. It also makes sure there is always a shell in the system by restarting another one each time the one it created is killed.

\section{Increment}

This simply counts up to the number you specified in the command line that started it. Each number is printed on its own line.

\section{Fibonacci}

This program calculates the Fibonacci serie up to the number specified in the command line that started it.

\section{Shell}

The shell is a large program with a lot of built-in functions. The shell allows you to start processes, interact with them and the I/O device, consult the information of the processes in the system ... Consult the appropriate section of the \textit{user programs guide} for a more detailed explanation of the shell's features. You can also get some help by using the command \textit{help} in the shell.

\section{Scroller}

This program scrolls a predefined text on the Malta LCD. It is started when the kernel does so. It can also be started or killed by the shell.

\section{Ring}

This program simulates a ring of processes that pass a message among themselves. You can define the number of processes involved (at least two) and the number of messages that will go through the ring before the program ends in the command line.

\section{Dining philosophers}

This program offers a solution to the dining philosophers problem using message passing. We chose to implement the waiter solution, where a waiter arbitrates the requests of the philosophers. Both the number of philosophers and the number of thinking-eating cycles have to be specified using the command line.

\section{Supervision}

This program shows how process supervision works in PORN-OS. It consists of a supervisor process that spawns child processes. Those processes send a given number of messages and "crashes". The supervisor's job is then to restart them. The number of children spawned is passed as an argument and has to be specified in the command line.

\section{Out of memory}

This well-named program shows how dynamic memory allocation works in PORN-OS. Indeed, it simply creates processes until the system runs out of memory. It also keeps the pid of the processes created in a linked list, dynamically allocated. Once it is not possible to create processes, the main process goes through its list, kills its children and frees the list.
